5-resultset
This overview is taken from jdbctm database access from javatm: a tutorial and annotated reference. Javasoft is currently preparing this book. This is a tutorial and an important reference manual for JDBC, which will be published by
With JDBC (including Oracle jdbc extensions), there is no direct (or standard) method to use ResultSet or RowSet to get the number of rows returned by the query. However, you can use scrollable ResultSet or Cached RowSet with very few lines of code
Detailed description of the Java resultset Interface
Record set Interface
In jdbc api 2.0, the resultset interface has changed a lot, adding a lot of new methods for Row Operations and row location, with strong functionality
The major changes are
The resultset API in JDBC does not directly obtain the number of records. Here we will introduce several methods: Method 1: Use the getrow method of resultset to obtain the total number of rows of resultset. Java code: resultset RS; RS. last (); //
The principle is to store a single piece of data with map and put it in the list.In this way, you can call list = Rs. selectrs (sqlstr );For (INT I = 0; I {(MAP) list. Get (I). Get ("username ");}In this way, you do not need to write database
Tag: exec count () performs a span by querying the specified send NECDriverManager (basic service for managing a set of JDBC drivers)It's method: getConnection(String url, String user, String password) .Connection (connection to a specific
Important NOTE: this part of the article is the owner of the collection from the Internet, and if you think that the content of the document violates your rights, please contact the collation (excelarthur@yahoo.com.cn), and Dev2dev site has nothing
PHP tutorial Introduction: Three MySQL + SQLite + pdo php database classes are supported at the same time: // mysql connect $ db = new SQL (mysql: host = localhost; database = 21andy_blog;, 21andy.com _ user, 21andy.com _ password); // PDO SQLite3
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.